package com.job.liushuang.HomeWork0722.No2;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @author Liushuang
 * @version 1.0
 * @since 2022-07-23 11:29:33
 */
public class MapString {
    public static void main(String[] args) {

        System.out.println("请输入一个字符串");
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
    }
    void stringMap(String str) throws string{
        if (str==null){
            throw new string("异常！字符里没有数字和字母");
        }
        //创建HashMap集合对象
        Map<Character,Integer> line=new HashMap<>();
        //遍历
        int number=0;
        int letter=0;
        for (int i = 0; i <str.length() ; i++) {
            char c=str.charAt(i);
            System.out.println(c);
            //判断
            if (Character.isUpperCase(str.charAt(i))||Character.isLetter(str.charAt(i))){
                if (c>=48&&c<=57){
                    number++;
                }else if (c>=97&&c<=122){
                    letter++;
                }
            }
        }
    }
}
